/*
	File: E:/3D/games/mgt/panzer_2010/data/scripts/scooter_animation.nut
	Author: The Team
*/

/*!
	@short	ScooterAnimation
	@author	The Team
*/
class	ScooterAnimation
{
	hoose_item		=	0
	scene			=	0
	speed			=	0.0
	phase			=	0.0
	scale_factor	=	1.0

	/*!
		@short	OnUpdate
		Called during the scene update, each frame.
	*/
	function	OnUpdate(item)
	{
		speed = ItemGetLinearVelocity(item).Len()
		phase += 10.0 * Clamp(speed, 0.0, 1.0)
		scale_factor = RangeAdjust(sin(DegreeToRadian(phase)), -1.0, 1.0, 0.45, 1.0)
		ItemSetScale(hoose_item, Vector(1, scale_factor, 1))
		
	}

	/*!
		@short	OnSetup
		Called when the item is about to be setup.
	*/
	function	OnSetup(item)
	{
		scene = ItemGetScene(item)
		hoose_item = SceneFindItemChild(scene, SceneFindItemChild(scene, item, "scooter_mesh"), "scooter_hose")
	}
}
